package com.rin.design_pattern.abstract_factory;

/**
 * @author RinMi
 * @since 2023/5/26
 */
public class FactoryProducer {

    private FactoryProducer(){

    }

    public static AbstractFactory getFactory(String factoryType) {
        if (factoryType == null) {
            return null;
        }
        if (FactoryType.SHAPE.equals(factoryType)) {
            return new ShapeFactory();
        }
        if (FactoryType.COLOR.equals(factoryType)) {
            return new ColorFactory();
        }
        System.err.println("创建: \"" + factoryType + "\"工厂时出错");
        return null;
    }
}
